<?php
class AddCategory extends Action {
	/*
	 * (non-PHPdoc) @see Action::execute()
	 */
	public function execute($params) {
		check_login ( ADMIN_LOGIN_PAGE );
		$data = sess_del ( 'category_info', array ('up_cid' => 0, 'up_name' => '顶级栏目', 'display' => 1 ) );
		
		$up_cid = irqst ( 'up_cid' );
		$cM = new WebPageCategory ();
		if ($up_cid) {
			$data ['up_cid'] = $up_cid;
			$data ['up_name'] = rqst ( 'up_cname' );
		}
		$data ['error'] = sess_del ( 'category_error', array () );
		$data ['error_cls'] = ModelValidator::getErrorCls ( $data ['error'] );
		$data ['page_tip_info'] = sess_del ( 'page_tip_info' );
		$data ['alert_cls'] = 'alert-error';
		$data ['treeNodes'] = json_encode ( $cM->getTreeNodes ( 0 ) );
		$data ['cate_types'] = apply_filter ( "get_category_types", array () );
		$data ['navi_active'] = '新频道栏目';
		return new SmartyView ( $data, 'vfs/CategoryForm' );
	}
}